import { observable, action } from 'mobx';
import { ComsStore } from './common';
import * as API from '../../apis/DocLog';
import { WeaLocaleProvider } from 'ecCom';

const getLabel = WeaLocaleProvider.getLabel;


export class DocLogStore extends ComsStore {
  @observable loading = false;
  @observable tabInfo = [
    {
      viewcondition: 0,
      title: getLabel(332, '全部'),
    },
    {
      viewcondition: 1,
      title: getLabel(21972, '已阅'),
    },
    {
      viewcondition: 4,
      title: getLabel(257, '打印'),
    },
    {
      viewcondition: 5,
      title: getLabel(31156, '下载'),
    },
  ];

  @observable viewcondition = 0;
  @observable showSearchAd = false;

  @action
  setState = (params = {}) => {
    Object.keys(params).forEach((key) => {
      this[key] = params[key];
    });
    return this;
  }

  getTabInfo = (params = {}) => {
    API.getTabInfo(params).then((data) => {
      this.tabInfo = data.groupinfo;
      this.loading = false;
    });
    return this;
  }
}
